#!/usr/bin/env bash
echo '脚本正在开发哦～'
ver=1.0
echo -e "\e[36m| 检查更新中...\e[0m"
# 获取最新版本
ver2=$(curl -sL https://gitee.com/bingxtang/btyun-Yunzai/raw/master/version)
# 检测版本
if [ ! "${ver2}" == "${ver}" ]
then
    echo -e "\e[36m| 发现新版本，正在更新\e[0m"
    if curl -o b https://gitee.com/bingxtang/btyun-Yunzai/raw/master/script.sh
        then
            mv b /usr/local/bin/b
            chmod +x /usr/local/bin/b
            echo -e "\e[36m| 更新完成\e[0m"
        else
            echo -e "\e[32m| 更新失败\e[0m"
    fi
else
    echo -e "\e[36m| 检查完成，已是最新\e[0m"
fi